package com.shankungfu.view;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager.LayoutParams;

import com.shankungfu.MainApplication;
import com.shankungfu.R;

/** 使用方法
 *  GeneralDialog dialog = new GeneralDialog(getActivity(), R.style.Transparent_Dialog, this);
    dialog.setShowText("是否清除所有缓存数据？");
    dialog.show();
 */

public class GeneralDialog extends Dialog {
	
	public GeneralDialog(Context context, boolean cancelable,
			OnCancelListener cancelListener) {
		super(context, cancelable, cancelListener);
		// TODO Auto-generated constructor stub
	}

	public GeneralDialog(Context context, int theme) {
		super(context, theme);
		// TODO Auto-generated constructor stub
	}

	public GeneralDialog(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
	}
	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.my_dialog_layout);
		initWindow();
	}
	
	private void initWindow() {
        LayoutParams p = getWindow().getAttributes();
        p.height = (int) (MainApplication.screenHight * 1);
        p.width = (int) (MainApplication.screenWidth * 1);
        p.alpha = 1f;
        getWindow().setAttributes(p);
    }
	
	public interface DialogCallBack {
		String data = "";
		
		public void setDialogData(String data);
		public void getDialogData(String data);
		
	}

}
